﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;

namespace Business.AutheAuthor
{
    public class ACLExamples
    {
        public static void DoACLExamples()
        {

            //DirectorySecurity ds = new DirectorySecurity(@"c:\Program Files", AccessControlSections.Access);
            //AuthorizationRuleCollection arc = ds.GetAccessRules(true, true, typeof(NTAccount));

            //foreach (FileSystemAccessRule ar in arc)
            //{
            //    Console.WriteLine(ar.IdentityReference + ": " + ar.AccessControlType + " " + ar.FileSystemRights);
            //}

            string dir = "c:\\myFolder";

            DirectorySecurity ds = new DirectorySecurity();
            ds.AddAccessRule(new FileSystemAccessRule("mita", FileSystemRights.FullControl, AccessControlType.Allow));

            Directory.CreateDirectory(dir, ds);



        }
    }
}
